package com.glp.work.flow.config;


import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import tk.mybatis.spring.annotation.MapperScan;


/**
 * @author liwenhong
 * @title 多数据源配置类
 * @date 2018/11/1.
 */
@Configuration
@MapperScan(basePackages = "com.glp.cash.mapper", sqlSessionTemplateRef = "sqlSessionTemplateOne")
public class SqlTemplateConfig {

    @Bean(name = "sqlSessionTemplateOne")
    @Primary
	@Autowired
    public SqlSessionTemplate sqlSessionTemplateOne(@Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
        return new SqlSessionTemplate(sqlSessionFactory);
    }

}
